<!DOCTYPE html>
<html lang="en">
<head>
    {% block head %}
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <!--    插入到页面标题上方-->
    {% for message in get_flashed_messages() %}
        <div class="alert">{{ message }}</div>
    {% endfor %}

    {% if current_user.is_authenticated %}
        <title>{{ current_user.username }}'s Watchlist</title>
    {% else %}
        <title>{{ user.name }}'s Watchlist</title>
    {% endif %}
    <link rel="icon" href="{{ url_for('static', filename='favicon.jpeg') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css">
    {% endblock %}
</head>
<body>
    <h2>
        <img alt="Avatar" class="avatar" src="{{ url_for('static', filename='images/avatar.png') }}">
        {% if current_user.is_authenticated %}
            <a target="_blank"  href="https://github653224.github.io/blogs">{{ current_user.username }}'s Watchlist</a>
        {% else %}
            <a target="_blank"  href="https://github653224.github.io/blogs">{{ user.name }}'s Watchlist</a>
        {% endif%}

    </h2>
    <nav>
        <ul>
            <li><a href="{{ url_for('movie_page') }}">Home</a></li>

            {% if current_user.is_authenticated %}
                <li><a href="{{ url_for('settings') }}">Settings</a></li>
                <li><a href="{{ url_for('logout') }}">Logout</a></li>
                <li><a>Hi {{ current_user.username}}</a></li>
            {% else %}
                <li><a href="{{ url_for('login') }}">Login</a></li>
                <li><a href="{{ url_for('register') }}">Register</a></li>
            {% endif %}
        </ul>
    </nav>

    {% block content %} {% endblock %}
    <footer>
        <img alt="Walking Totoro" class="totoro" src="{{ url_for('static', filename='images/totoro.gif') }}" title="to~to~ro~">
        <small>&copy; 2021 <a target="_blank" href="https://github653224.github.io/blogs">Jack Pan</a></small>
<!--        <small>&copy; 2018 <a href="http://helloflask.com/tutorial">HelloFlask</a></small>-->
    </footer>
</body>
</html>